﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 双向绑定2改进再改进
{
    public partial class Form1 : Form
    {
        private Data _data;
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            _data = Data.Ins;
            textBox1.DataBindings.Add("Text", _data, "String1", false, DataSourceUpdateMode.OnPropertyChanged);
            textBox2.DataBindings.Add("Text", _data, "String2", false, DataSourceUpdateMode.OnPropertyChanged);
        }

        private void button3_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.Show();
            Console.ReadLine();
        }
    }
}
